package _021_10_3

func titleToNumber(columnTitle string) int {
	excelM := make(map[byte]int)
	for i := 0; i < 26; i++ {
		excelM[byte('A'+i)] = i + 1
	}

	n := len(columnTitle)
	sum := 0
	mutiple := 1
	for i := 0; i < n; i++ {
		sum += excelM[columnTitle[n-i-1]] * mutiple
		mutiple *= 26
	}
	return sum
}
